    function initAllData() {
      var req = opensocial.newDataRequest();
      req.add(req.newFetchPersonRequest('VIEWER', {profileDetail : ['id', 'name', 'thumbnailUrl', 'aboutMe', 'profileUrl']}), 'viewer');
      req.add(req.newFetchPeopleRequest(new opensocial.IdSpec({'userId' : 'OWNER', 'groupId' : 'FRIENDS'}), {max: 50, profileDetail: ['id', 'name', 'thumbnailUrl', 'aboutMe', 'profileUrl']}), 'ownerFriends');
      req.add(req.newFetchPeopleRequest(new opensocial.IdSpec({'userId' : 'OWNER', 'groupId' : 'FRIENDS'}), {max: 50, profileDetail: ['id', 'name', 'thumbnailUrl', 'aboutMe', 'profileUrl']}), 'viewerFriends');
      req.add(req.newFetchActivitiesRequest(new opensocial.IdSpec({'userId' : 'OWNER', 'groupId' : 'FRIENDS'})), 'owneractivities');
      req.add(req.newFetchActivitiesRequest(new opensocial.IdSpec({'userId' : 'VIEWER', 'groupId' : 'FRIENDS'})), 'vieweractivities');
      req.send(setupData);
    };

    var viewer, ownerFriends, peopleView;
    
    function showActivities(acts, elementid, heading) {
      html = "";
      var maxActs=6, actCount=0;
      
      if (acts) {
        var activities =  acts.getData().asArray();
        html +='<h3>' + heading +'</h3>';
        for (var i = 0; i < activities.length && actCount < maxActs; i++) {
          var activity = activities[i];
          url = activity.getField('url');
          if (url && url.indexOf('socialmediate') == -1) {
            person = peopleView[activity.getField('userId')];
            html += "<div class='item'>";
            if (person) {html += person;}
            html += gadgets.util.unescapeString(activity.getField('title')) + "</div>";
            actCount +=1;
          };
        };
      }; 
      document.getElementById(elementid).innerHTML = html;
    };
    function setupData(data) {
      ownerFriends = [];
      ownf = data.get('ownerFriends').getData();
      if (ownf) { ownerFriends = ownf.asArray(); };
      peopleView={};
      for (var i = 0; i < ownerFriends.length; i++) {
        var person = ownerFriends[i];
        var id = person.getId();
        peopleView[id]= '<a href="' + person.getField('profileUrl') +'" title="'+ person.getDisplayName() +'" >' 
          + '<img class="memberPhoto" width="20" src="' + person.getField("thumbnailUrl")  + '"/></a>';
        html += peopleView[id];
      };

      if (data.get('viewer').getData() != null) {
        viewer = data.get('viewer').getData();
      }
      showActivities(data.get('owneractivities'),'owneractivities', 'read by everyone');
      showActivities(data.get('vieweractivities'),'vieweractivities', 'read by your friends');
    };
      